<?php
namespace app\admin\controller;

use app\api\model\User as UserModel;
class User extends Base
{

    public function all()
    {
        return view('all');
    }

    public function getAllUser()
    {
        $params = request()->param();
        $where = [];
        if( $params['nickname'] ){
            $where['nickname'] = ['like','%'.$params['nickname'].'%'];
        }
        $obj = UserModel::where($where);
        $list = $obj->limit($params['offset'],$params['limit'])->select()->toArray();
        $total = UserModel::where($where)->count();

        return ['code' => 200, 'msg' => 'ok', 'data' => compact('total','list')];
    }

}